home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Interactive Web Graphics with Shout 3D
/
Interactive Web Graphics With Shout 3D.iso
/
mac
/
Code
/
Chapter Code.exe
/
Chapter09
/
ProcAnimPanel.java
< prev
next >
Wrap
Text File
|
2000-07-05
|
940b
|
61 lines
package applets;
import shout3d.*;
import shout3d.core.*;
import shout3d.math.*;
public class ProcAnimPanel extends Shout3DPanel implements RenderObserver{
Transform t;
float xPos;
public ProcAnimPanel (Shout3DApplet applet){
super(applet);
}
public void customInitialize() {
getRenderer().addRenderObserver(this, null);
t = (Transform) getNodeByName("trans");
xPos = t.translation.getValue()[0];
}
protected void finalize() {
getRenderer().removeRenderObserver(this);
}
public void onPreRender (Renderer r, Object o) {
//movement since previous frame
//at .5 meter per second.
float xDelta = .5f/getFramesPerSecond();
//add to current x postion
xPos = xPos + xDelta;
//update Transform
t.translation.set1Value(0, xPos);
}
public void onPostRender (Renderer r, Object o) {
}
} //end of class